/****************************************************************************
 *  QLyrics - A simple lyrics viewer.                                       *
 *  Copyright (C) 2008  hsys <hanshuiys@gmail.com>                          *
 *                                                                          *
 *  This program is free software; you can redistribute it and/or modify    *
 *  it under the terms of the GNU General Public License as published by    *
 *  the Free Software Foundation; either version 3 of the License, or       *
 *  (at your option) any later version.                                     *
 *                                                                          *
 *  This program is distributed in the hope that it will be useful,         *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 *  GNU General Public License for more details.                            *
 *                                                                          *
 *  You should have received a copy of the GNU General Public License       *
 *  along with this program; if not, write to the Free Software Foundation, *
 *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA       *
 ****************************************************************************/

#ifndef _LYRICSWINDOW_H_
#define _LYRICSWINDOW_H_

#include <QMainWindow>
#include <QMenu>
#include "lyricspanel.h"

/** Main window. */
class LyricsWindow : public QMainWindow {
    Q_OBJECT
public:
    LyricsWindow(QWidget* parent = 0);
    ~LyricsWindow();

protected:
    void contextMenuEvent(QContextMenuEvent*);
    void mousePressEvent(QMouseEvent*);
    void mouseMoveEvent(QMouseEvent*);
    void mouseReleaseEvent(QMouseEvent*);
    void paintEvent(QPaintEvent*);
    void closeEvent(QCloseEvent*);

private:
    LyricsPanel* m_panel;
    QMenu* m_popupMenu;

    QPoint m_mousePos;
    Qt::MouseButton m_mouseButton;
    bool m_mouseOnRightEdge, m_mouseOnBottomEdge;

    void createMenu();
    void setAlphaChannel();

private slots:
    void downloadLyrics();
    void showDownloadWindow(LyricsJob*);
    /** Display a about window. */
    void showAboutWindow();
    /** Display the configure window. */
    void showConfigWindow();
    /** Display a message box to show lyrics properties. */
    void showLyricsProp();
    /** Reload window style from setting file. */
    void reloadWindowStyle();
    /** Reconstruct the main panel. */
    void reloadPanel();
    /** Run external lyrics editor. */
    void runLyricsEditor();
};

#endif
